//
//  UIScrollView+Refresh.m
//  bufafa
//
//  Created by MacBook on 2018/4/23.
//  Copyright © 2018年 HomNee. All rights reserved.
//

#import "UIScrollView+Refresh.h"

@implementation UIScrollView (Refresh)
- (void)addRefreshViews:(id)target{
    [self addHeaderRefresh:target];
    [self addFooterRefresh:target];
}

- (void)addHeaderRefresh:(id)target{
    MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:target refreshingAction:@selector(loadNewData)];
    header.lastUpdatedTimeLabel.hidden = YES;
//    [header setTitle:@"下拉刷新" forState:MJRefreshStateIdle];
//    [header setTitle:@"释放更新" forState:MJRefreshStatePulling];
//    [header setTitle:@"加载中..." forState:MJRefreshStateRefreshing];
    header.stateLabel.textColor = UIColorFromRGB(0x666666);
    self.mj_header = header;
}
- (void)addFooterRefresh:(id)target{
    MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:target refreshingAction:@selector(loadMoreData)];
    footer.height = 60;
    footer.stateLabel.textColor = UIColorFromRGB(0x666666);
    self.mj_footer = footer;
}

- (void)endRefreshs{
    [self.mj_header endRefreshing];
    [self.mj_footer endRefreshing];
//    self.mj_footer.hidden = NO;
}
- (void)loadNewData{
    
}

- (void)loadMoreData{
    
}

@end
